///////////////////////////////////////////////////////////
//  messagedef.h
//  Implementation of the messagedef
//  Created on:      08-Apr-2009 10:06:32 AM
//  Original author: Tim Kuo
///////////////////////////////////////////////////////////

#if !defined(EA_9F454DB8_A969_4830_9B7B_1DCC06DF5CD6__INCLUDED_)
#define EA_9F454DB8_A969_4830_9B7B_1DCC06DF5CD6__INCLUDED_

#include "common.h"

#define EventDb (2000)
#define EventNet (3000)
#define EventLocal (4000)


enum MESSAGE_TYPE {
	ACTION_COMMON = ((GROUP_COMMON|ACTION_FLAG )<<24),
	EVENT_COMMON = ((GROUP_COMMON|EVENT_FLAG )<<24),
	MESSAG_COMMON_END
};

enum MESSAGE_STAFFMGNT {
	ACTION_SM=
		((GROUP_STAFFMGNT|ACTION_FLAG)<<24),
	ACTION_SM_BROWSE=
		((ACTION_SM|0x00FF0000)&((SUBGROUP_SM_STAFFBROWSE<<16)|0xFF000000)),
	ACTION_SM_INFOMGNT=
		((ACTION_SM|0x00FF0000)&((SUBGROUP_SM_INFOMGNT<<16)|0xFF000000)),
	ACTION_SM_SALARYMGNT=
		((ACTION_SM|0x00FF0000)&((SUBGROUP_SM_SALARYMGNT<<16)|0xFF000000)),
	ACTION_SM_PASSWORDMGNT=
		((ACTION_SM|0x00FF0000)&((SUBGROUP_SM_PASSWORDMGNT<<16)|0xFF000000)),
	ACTION_SM_ADVANCEDMGNT=
		((ACTION_SM|0x00FF0000)&((SUBGROUP_SM_ADVANCEDMGNT<<16)|0xFF000000)),
	EVENT_SM=
		((GROUP_STAFFMGNT|EVENT_FLAG)<<24),
	MESSAGE_SM_END
};

enum MESSAGE_BUSINESSMGNT {
	ACTION_BM=
		((GROUP_BUSINESSMGNT|ACTION_FLAG)<<24),
	ACTION_BM_BROWSE=
		((ACTION_BM|0x00FF0000)&((SUBGROUP_BM_BROWSE<<16)|0xFF000000)),
	ACTION_BM_INFOMGNT=
		((ACTION_BM|0x00FF0000)&((SUBGROUP_BM_INFOMGNT<<16)|0xFF000000)),
	ACTION_BM_RECORDMGNT=
		((ACTION_BM|0x00FF0000)&((SUBGROUP_BM_RECORDMGNT<<16)|0xFF000000)),
	ACTION_BM_ADVANCEMGNT=
		((ACTION_BM|0x00FF0000)&((SUBGROUP_BM_ADVANCEDMGNT<<16)|0xFF000000)),
	EVENT_BM=
		((GROUP_BUSINESSMGNT|EVENT_FLAG)<<24),
	MESSAGE_BM_END
};

enum MESSAGE_CUSTOMERMGNT {
	ACTION_CM=
		((GROUP_CUSTOMERMGNT|ACTION_FLAG)<<24),
	ACTION_CM_BROWSE=
		((ACTION_CM|0x00FF0000)&((SUBGROUP_CM_BROWSE<<16)|0xFF000000)),
	ACTION_CM_INFOMGNT=
		((ACTION_CM|0x00FF0000)&((SUBGROUP_CM_INFOMGNT<<16)|0xFF000000)),
	ACTION_CM_RECORDMGNT=
		((ACTION_CM|0x00FF0000)&((SUBGROUP_CM_RECORDMGNT<<16)|0xFF000000)),
	ACTION_CM_ADVANCEMGNT=
		((ACTION_CM|0x00FF0000)&((SUBGROUP_CM_ADVANCEDMGNT<<16)|0xFF000000)),
	EVENT_CM=
		((GROUP_CUSTOMERMGNT|EVENT_FLAG)<<24),
	MESSAGE_CM_END
};

enum MESSAGE_STOCKMGNT {
	ACTION_ST= 
		((GROUP_STOCKMGNT|ACTION_FLAG)<<24),
	ACTION_ST_BROWSE=
		((ACTION_ST|0x00FF0000)&((SUBGROUP_ST_BROWSE<<16)|0xFF000000)),
	ACTION_ST_BROWSERECORDS=
		((ACTION_ST|0x00FF0000)&((SUBGROUP_ST_BROWSERECORDS<<16)|0xFF000000)),
	ACTION_ST_ADVANCEMGNT=
		((ACTION_ST|0x00FF0000)&((SUBGROUP_ST_ADVANCEDMGNT<<16)|0xFF000000)),
	EVENT_ST=
		((GROUP_STOCKMGNT|EVENT_FLAG)<<24),
	MESSAGE_ST_END
};


/*ACTION format: 
Action Flag(highest 1 bit) + GROUP(next 7 bits) + 
SUBGROUP(next 8 bits) + Action id(lowest 16 bits)*/
enum ACTION{
	ACTION_SYSTEM_START = ACTION_COMMON + 1,
	ACTION_INIT_DB,
	ACTION_SETSUPERUSER,
	ACTION_LOGIN,
	ACTION_LOGOFF,
	ACTION_EXIT,
	ACTION_MAINMENU,
	ACTION_GETLOGGEDSTAFF,

	ACTION_STAFFMGNT = ACTION_SM + 1,
	ACTION_GEALLSTAFF,
	ACTION_GETJOBTYPE,
	ACTION_GETLEVELTYPE,
	ACTION_GETSTATUSTYPE,
	ACTION_CHANGEPASSWORD,
	ACTION_SETPICTURE,
	ACTION_GETSTAFF = ACTION_SM_BROWSE + 1,
	ACTION_GETPICTURE,
	ACTION_ADDSTAFF = ACTION_SM_INFOMGNT + 1,
	ACTION_REMOVESTAFF,
	ACTION_MODIFYSTAFF,
	ACTION_RESETPASSWORD,
	ACTION_VIEWSTAFFTASKS = ACTION_SM_SALARYMGNT +1,
	ACTION_VIEWSTAFFSALARY,
	ACTION_MODIFYSTAFFSALARY,
	ACTION_SETJOBTYPE = ACTION_SM_ADVANCEDMGNT + 1,
	ACTION_SETLEVELTYPE,
	ACTION_REMOVEJOBTYPE,
	ACTION_REMOVELEVELTYPE,
	ACTION_SETSTATUSTYPE,

	ACTION_BUSINESSMGNT = ACTION_BM + 1,
	ACTION_GETBUSINESSTYPE,
	ACTION_GETALLBUSINESS,
	ACTION_GETBUSINESS = ACTION_BM_BROWSE + 1,
	ACTION_GETBUSINESSPIC,
	ACTION_ADDBUSINESS = ACTION_BM_INFOMGNT + 1,
	ACTION_REMOVEBUSINESS,
	ACTOIN_MODIFYBUSINESS,
	ACTION_VIEWBUSINESSRECORD = ACTION_BM_RECORDMGNT + 1,
	ACTION_SETBUSINESSTYPE = ACTION_BM_ADVANCEMGNT + 1,
	ACTION_REMOVEBUSINESSTYPE,

	ACTION_CUSTOMERMGNT = ACTION_CM + 1,
	ACTION_GETCUSTOMERLEVEL,
	ACTION_GETALLCUSTOMER,
	ACTION_GETCUSTOMER = ACTION_CM_BROWSE + 1,
	ACTION_GETCUSTOMERPIC,
	ACTION_ADDCUSTOMER = ACTION_CM_INFOMGNT + 1,
	ACTION_REMOVECUSTOMER,
	ACTOIN_MODIFYCUSTOMER,
	ACTION_VIEWCONSUMERECORD = ACTION_CM_RECORDMGNT + 1,
	ACTION_SETCUSTOMERLEVEL = ACTION_CM_ADVANCEMGNT + 1,
	ACTION_REMOVECUSTOMELEVEL,

	ACTION_STOCKMGNT = ACTION_ST + 1,
	ACTION_GETCOMMODITIES = ACTION_ST_BROWSE + 1,
	ACTION_GETSTOCKING = ACTION_ST_BROWSERECORDS + 1,
	ACTION_GETINVENTORY,
	ACTION_STOCKIN = ACTION_ST_ADVANCEMGNT + 1,
	ACTION_STOCKOUT,
	ACTION_CHECKINVENTORY,
	ACTION_SUBMITINVENTORY,
	ACTION_SETSTOCKWARNINGLEVEL,
	ACTION_SETCHECKDATE,
	
	ACTION_END
};

enum EVENT{
	EVENT_SYSTEM_START = EVENT_COMMON +1,
	EVENT_INIT,
	EVENT_INIT_FINISHED,
	EVENT_WIZARD,
	EVENT_SETSUPERUSER,
	EVENT_LOGGEDIN,
	EVENT_LOGGEDOFF,
	EVENT_EXIT,
	EVENT_MAINMENU,
	EVENT_LOGGEDSTAFF,
	EVENT_RIGHTERROR,

	EVENT_STAFFMGNT = EVENT_SM + 1,
	EVENT_ALLSTAFF,
	EVENT_JOBTYPE,
	EVENT_LEVELTYPE,
	EVENT_STATUSTYPE,
	EVENT_CHANGEPASSWORD,
	EVENT_SETPICTURE,
	EVENT_STAFF,
	EVENT_GETPICTURE,
	EVENT_STAFFADDED,
	EVENT_STAFFREMOVED,
	EVENT_STAFFMODIFIED,
	EVENT_RESETPASSWORD,
	EVENT_VIEWSTAFFTASKS,
	EVENT_VIEWSTAFFSALARY,
	EVENT_MODIFYSTAFFSALARY,
	EVENT_SETJOBTYPE,
	EVENT_SETLEVELTYPE,
	EVENT_REMOVEJOBTYPE,
	EVENT_REMOVELEVELTYPE,
	EVENT_SETSTATUSTYPE,
	EVENT_STAFFMGNT_END,

	EVENT_BUSINESSMGNT = EVENT_BM +1,
	EVENT_BUSINESSTYPE,
	EVENT_ALLBUSINESS,
	EVENT_BUSINESS,
	EVENT_BUSINESSPIC,
	EVENT_ADDBUSINESS,
	EVENT_REMOVEBUSINESS,
	EVENT_MODIFYBUSINESS,
	EVENT_BUSINESSRECORD,
	EVENT_SETBUSINESSTYPE,
	EVENT_REMOVEBUSINESSTYPE,

	EVENT_CUSTOMERMGNT = EVENT_CM + 1,
	EVENT_CUSTOMERLEVEL,
	EVENT_ALLCUSTOMERS,
	EVENT_CUSTOMER,
	EVENT_CUSTOMERPIC,
	EVENT_ADDCUSTOMER,
	EVENT_REMOVECUSTOMER,
	EVENT_MODIFYCUSTOMER,
	EVENT_CONSUMERECORDS,
	EVENT_SETCUSTOMERLEVEL,
	EVENT_REMOVECUSTOMERLEVEL,

	EVENT_STOCKMGNT = EVENT_ST + 1,
	EVENT_COMMODITIES,
	EVENT_STOCKING,
	EVENT_INVENTORY,
	EVENT_STOCKIN,
	EVENT_STOCKOUT,
	EVENT_CHECKINVENTORY,
	EVENT_SUBMITINVENTORY,
	EVENT_SETSTOCKWARNINGLEVEL,
	EVENT_SETCHECKDATE,
	
	EVENT_END
};

#endif // !defined(EA_9F454DB8_A969_4830_9B7B_1DCC06DF5CD6__INCLUDED_)
